package kr.hkit.powerjava.chapter24;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class ScanTest2 {
	public static void main(String[] args) throws IOException {

		int i = 8;
		double r = Math.log(i);
		
		System.out.format("log(" + "%d" + ")은 " + "%-20.10f" + "입니다.%n", i, r);
		
		
		Scanner s = null;
		double sum = 0;
		PrintWriter out = null;

		out = new PrintWriter(new FileWriter("output.txt"));
		out.println("9.5");
		out.println("567,000");
		out.flush();
		s = new Scanner(new BufferedReader(new FileReader("output.txt")));
		while (s.hasNext()) {
			if (s.hasNextDouble()) {
				sum = sum + s.nextDouble();
			} else {
				s.next();
			}
		}

		if (out != null) {
			out.close();
		}
		if (s != null) {
			s.close();
		}
		System.out.println(sum);
	}
}
